import {
  ExpansionPanel,
  ExpansionPanelList,
  ExpansionPanelListItem
} from 'gatsby-theme-apollo-docs';

<ExpansionPanel title="Carthage Installation">

<ExpansionPanelList>
<ExpansionPanelListItem number="1">

<h4>Set up your `Cartfile`</h4>

Add `github "apollographql/apollo-ios"` to your Cartfile. 

</ExpansionPanelListItem>
<ExpansionPanelListItem number="2">

<h4>Checkout and build dependencies</h4>

Run `carthage update --platform ios` (or `--platform ios,macos` to build both Mac and iOS). **NOTE:** There's an issue with the way Carthage uses Lipo in the Xcode 12 GM, please cd into `[YourProject]/Carthage/Checkouts/apollo-ios/scripts` and then run `./carthage-build-workaround.sh` to actually get Carthage builds that work.

</ExpansionPanelListItem>
<ExpansionPanelListItem number="3"> 

<h4>Add built frameworks to your project</h4>

Drag and drop `Apollo.framework` from the appropriate `Carthage/Build/iOS` or `Carthage/Build/Mac` folder to the **Embedded Binaries** section of your application target's **General** settings tab. This should also cause them to appear in the **Linked Frameworks And Libraries** section automatically.
  - If you also plan on using the `ApolloSQLite` library, also drag `ApolloSQLite.framework` and `SQLite.framework` to this area as well.
  - If you also plan on using the `ApolloWebSocket` library, also drag `ApolloWebSocket.framework` and `Starscream.framework` to this area as well.

</ExpansionPanelListItem>
<ExpansionPanelListItem number="4">

<h4>Work around Carthage submission bug</h4>

On your application target's **Build Phases** settings tab, click the **+** icon and choose **New Run Script Phase**. Create a Run Script in which you specify your shell (ex: `bin/sh`), add the following contents to the script area below the shell:

 ```sh
 /usr/local/bin/carthage copy-frameworks
 ```

and add the paths to the frameworks you want to use under **Input Files**, e.g.:

 ```
 $(SRCROOT)/Carthage/Build/iOS/Apollo.framework
 ```
 
Again, if you're adding `ApolloSQLite` or `ApolloWebSocket`, please make sure to add the other frameworks you added as Input Files. 
 
This script works around an [App Store submission bug](http://www.openradar.me/radar?id=6409498411401216) triggered by universal binaries and ensures that necessary bitcode-related files and dSYMs are copied when archiving.

</ExpansionPanelListItem>
<ExpansionPanelListItem number="check">
  You're done!
</ExpansionPanelListItem>
</ExpansionPanelList>

</ExpansionPanel>
